﻿using System;
using System.Threading.Tasks;
using kemocard.Scripts.Module.Battle;

namespace kemocard.Scripts.Card.Scripts;

public class BaseAttackCard : BaseCardScript
{
    protected Action<BaseBattleCard> AfterDoDamage;

    public sealed override async Task UseCard(BaseBattleCard parent)
    {
        var damage = CreateDamageFromOwner(parent);
        CustomizeDamage(ref damage, parent);
        if (Mod != null)
        {
            await Mod.DoDamage(damage);
        }

        AfterDoDamage?.Invoke(parent);
    }

    protected virtual void CustomizeDamage(ref Damage damage, BaseBattleCard parent)
    {
    }
}